package com.study.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.convert.DataSizeUnit;
import org.springframework.boot.convert.DurationUnit;
import org.springframework.stereotype.Component;
import org.springframework.util.unit.DataSize;
import org.springframework.util.unit.DataUnit;

import java.time.Duration;
import java.time.temporal.ChronoUnit;

/**
 * @desc:
 * @author: panxiyi
 * @date: 2023/4/17 9:59 上午
 */

@Component
@Data
@ConfigurationProperties("servers")
public class ServerConfig {

    private String ipAddress;

    private int port;

    private long timeout;


    @DurationUnit(ChronoUnit.DAYS)
    private Duration serverTimeOut;

    @DataSizeUnit(DataUnit.KILOBYTES)
    private DataSize dataSize;
}
